#include <bits/stdc++.h>

using namespace std;

/**
 * Definition for singly-linked list.
 */
struct ListNode {
    int val;
    ListNode *next;
    ListNode() : val(0), next(nullptr) {}
    ListNode(int x) : val(x), next(nullptr) {}
    ListNode(int x, ListNode *next) : val(x), next(next) {}
};

class Solution {
public:
    ListNode* mergeNodes(ListNode* head)
    {
	vector<int> resVec;
	int temp {};
	for (ListNode* p = head->next; p; p = p->next) {
	    if (p->val == 0) {
		resVec.push_back(temp);
		temp = 0;
	    } else {
		/* temp *= 10; */
		temp += p->val;
	    }
	}
	head->next=nullptr;
	ListNode* p =head;
	for(int i=0,len=size(resVec);i<len;++i){
	    auto newList=new ListNode(resVec[i]);
	    p->next = newList;
	    p = p->next;
	}
	return head->next;
    }
};
int main()
{
    [[maybe_unused]] Solution solution;
    return 0;
}
